package tang.server;

import java.util.concurrent.CountDownLatch;

/**
 * @author Tang
 * @classname ZkServerShutdownHandler
 * @description [  ]
 * @date 2021/2/28 21:31
 */
public class ZkServerShutdownHandler {

    private final CountDownLatch countDownLatch;

    public ZkServerShutdownHandler(CountDownLatch countDownLatch) {
        this.countDownLatch = countDownLatch;
    }

    void handler(ZkServer.States states) {
        if (states == ZkServer.States.ERROR || ZkServer.States.SHUTDOWN == states) {
            this.countDownLatch.countDown();
        }
    }

}